<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加</title>
    <link rel="stylesheet" type="text/css" href="{__STATIC_PATH__}layui/css/layui.css">
    <script type="text/javascript" src="{__STATIC_PATH__}layui/layui.js"></script>
</head>
<body style="padding: 10px;">
    <form class="layui-form" action="">
        <input class="layui-input" type="hidden" name="uid" value="{$admin.uid}">
        <div class="layui-form-item">
            <label class="layui-form-label">账户</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="account" value="{$admin.account}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="password" name="password" value="{$admin.password}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="name" value="{$admin.name}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="status">
                    <option value="1" {if $admin['status'] ==1}selected {/if}>开启</option>
                    <option value="0" {if $admin['status'] ==0}selected {/if}>关闭</option>
                </select>
            </div>
        </div>
    </form>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" onclick="save()">保存</button>
        </div>
    </div>
    <script type="text/javascript">
			layui.use(['layer','form'],function(){
			form = layui.form;
			layer = layui.layer;
			$ = layui.jquery;
		}); 
        function save(){
			$.post('/admin/admin/edit',$('form').serialize(),function(res){
				if(res.code>0){
					layer.alert(res.msg,{icon:2});
				}else{
					layer.msg(res.msg);
					setTimeout(function(){parent.window.location.reload();},1000);
				}
			},'json');
        }   
    </script>
    </body>
    </html>